package com.example.controller;

import com.example.data.request.ReqTeacherList;
import com.example.entity.Teacher;
import com.example.service.impl.TeacherServiceImpl;
import com.example.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * Author:yanghua
 * Date:2023/10/8 8:29
 */
@Slf4j
@RestController
@RequestMapping("teacher")
public class TeacherController {
    @Resource
    private TeacherServiceImpl teacherService;
    @PostMapping("addTeacher")
    private R add(@RequestBody Teacher teacher) {
        return teacherService.addTeacher(teacher);
    }
    @DeleteMapping("deleteTeacherById/{id}")
    private R delete(@PathVariable Long id) {
        return teacherService.deleteTeacher(id);
    }
    @PutMapping("updateTeacherById")
    private R updateTeacher(@RequestBody Teacher teacher) {
        return teacherService.updateTeacher(teacher);
    }
    @PostMapping("getTeacherList")
    private R getTeacherList(@RequestBody ReqTeacherList reqTeacherList) {
        return teacherService.getTeacherList(reqTeacherList);
    }
}
